package org.fuxia.im.core.entries;

import java.util.HashMap;
import java.util.Map;

import com.alibaba.fastjson.annotation.JSONField;
/**
 * 服务器发送给客户端的响应信息
 *
 */
public class ECResponse
{
	private static final String	STATTUS_CODE	= "statusCode";
	private static final String	RESPONSE_TEXT	= "responseText";

	private String				className		= ECResponse.class.getName();
	private String				responseType	= "RESPONSE";

	@JSONField(serialize = true)
	private Map<Object, Object>	values			= new HashMap<Object, Object>();

	public Integer getStatusCode()
	{
		return (Integer) values.get(STATTUS_CODE);
	}

	public Object get(Object infoField)
	{
		return values.get(infoField);
	}

	public void put(Object key , Object value)
	{
		this.values.put(key, value);
	}

	@JSONField(serialize = false)
	public void setStatusCode(Integer value)
	{
		this.put(STATTUS_CODE, value);
	}

	@JSONField(serialize = false)
	public void setResponseText(String text)
	{
		this.put(RESPONSE_TEXT, text);
	}

	public String getResponseText()
	{
		return this.get(RESPONSE_TEXT) == null ? "" : this.get(RESPONSE_TEXT).toString();
	}

	public void setValues(Map<Object, Object> values)
	{
		this.values = values;
	}

	public Map<Object, Object> getValues()
	{
		return this.values;
	}

	public String getClassName()
	{
		return className;
	}

	public void setClassName(String className)
	{
		this.className = className;
	}

	public String getResponseType()
	{
		return responseType;
	}

	public void setResponseType(String responseType)
	{
		this.responseType = responseType;
	}

	@Override
	public String toString()
	{
		return "ECResponse [values=" + values + "]";
	}

}
